package Controller.reply;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import Bean.ReplyBean;
import Dao.ReplyDao;

public class ReplyreplySupdateController implements Controller{
	private ReplyDao dao;
	
	public void setDao(ReplyDao dao) {
		this.dao = dao;
	}

	@Override
	public ModelAndView handleRequest(HttpServletRequest req,
			HttpServletResponse res) throws Exception {
		Integer sr_no = Integer.parseInt(req.getParameter("sr_no"));
		String context = req.getParameter("context");
		Integer sr_sb_no = Integer.parseInt(req.getParameter("sb_no"));
		System.out.println(sr_no);
		System.out.println(context);
		
		ReplyBean reply = new ReplyBean();
		
		reply.setSr_no(sr_no);
		reply.setSr_context(context);
		
		dao.replySupdate(reply);
		ModelAndView mav = new ModelAndView();
		mav.setViewName("redirect:/sBoardReplyList.reply?sb_no="+sr_sb_no);
		return mav;
	}
}
